package com.my.factory.simpleFactory;

import com.my.product.Product;

/**
 * com.my.factory.simpleFactory
 * linwenjie
 * 2019-06-10
 * 简单工厂模式
 */
public class SimpleFactory {
    Product createProduct(Class classname) {
        try {
            if (classname != null) {

                return (Product) classname.newInstance();

            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
